<template>
	<view class="container">
		<view style="width: 670rpx;margin-left: 40rpx;display: flex;flex-direction: column;align-items: center;">
			<view style="width: 100%;">
				输入二维码内容
			</view>
			<view style="display: flex;flex-direction: row;align-items: center;margin-top: 40rpx;">
				<u-input v-model="formModel.content" placeholder='请输入' maxlength='30'/>
				<view style="width: 200rpx;"><u-button type="primary" text="生成" @click='createCodeAction'></u-button></view>
			</view>
			<image style="margin-top: 60rpx;" :src="'data:image/png;base64,' + base64_code" mode=""
			:style="{
				'width': '500rpx',
				'height': '500rpx',
			}"></image>
		</view>
	</view>
</template>

<script>
	import { common } from '@/api/common.js'
	export default{
		components: {},
		data() {
			return {
				base64_code: '',
				formModel: {}
			}
		},
		onLoad() {
		},
		methods:{
			createCodeAction(){
				this.createCode(this.formModel.content)
			},
			createCode(content) {
				common.createCode({
					content: content 
				}).then(res => {
					if (res.data.code == 10000) {
						this.base64_code = res.data.data
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	
</style>
